<template>

  <van-tabbar class="fixed footer clearfix" v-model="active">
    <router-view />

    <van-tabbar-item  icon="home-o" to="/">首页</van-tabbar-item>
    
    <van-tabbar-item icon="clock-o" to="/video">
      <div slot="icon">
         <van-icon class-prefix="icon" class="iconfont" name="shipin1"/>
       </div>
      心灵鸡汤
      </van-tabbar-item>
     <van-tabbar-item to="/seckill" >
       <div slot="icon">
         <van-icon class-prefix="icon" class="iconfont" name="31shijian"/>
       </div>
       秒抢
    </van-tabbar-item>
    <!-- <van-tabbar-item  icon="cart-o" to="/cart">购物车</van-tabbar-item> -->
    <van-tabbar-item icon="user-o" to="/mine">我的</van-tabbar-item>
  </van-tabbar>
</template>
<script>
import { Toast } from 'vant';
export default {
  name: "Footer",
  data() {
    return {
      active: '0',
      icon: '',
      nowPath: ''
    };
  },
  methods:{
    upactive(){					
      let nowPath=this.$route.path;
      switch (nowPath) {
        case '/video':
          this.active = 1;
          break;
        case '/seckill':
            this.active = 2;
            
            break;
        // case '/cart':
        //     this.active = 3
        //     break;
        case '/mine':
            this.active = 3
            break;
        default:
          this.active = 0
          break;
      }
    }	
  },
  created(){
      this.upactive();
  },
  activated() {
    this.upactive()
  },
  deactivated() {
    this.upactive()
  }
};
</script>
<style>
.footer {
  bottom: 0;
  left: 0;
  right: 0; 
  z-index: 9!important
}
</style>